package com.creatshare.config;

import java.util.LinkedList;
import java.util.List;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;

/*@Configuration
@ComponentScan("com.creatshare.controller")*/
public class Config_MVC {
	@Bean
	public MappingJackson2HttpMessageConverter mappingJacksonHttpMessageConverter() {
		MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
		mappingJackson2HttpMessageConverter.setPrefixJson(false);
		List<MediaType> mediaTypeList = new LinkedList<MediaType>();
		mediaTypeList.add(new MediaType("application/json"));
		mappingJackson2HttpMessageConverter.setSupportedMediaTypes(mediaTypeList);
		return mappingJackson2HttpMessageConverter;
	}
	
	public ObjectMapper objectMapper(){
		ObjectMapper objectMapper=new ObjectMapper();
//		SerializationInclusion 
		objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
		return objectMapper;
	}
	
}
